<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>vue2.x</title>
</head>

<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <div id="app">
        <button v-on:click="greet">Greet</button>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                name: 'vue'
            },
            methods: {
                greet: function (event) {
                    alert('Hello ' + this.name + '!')
                    // `event` 是原生 DOM 事件
                    if (event) {
                        console.log(event);
                        alert(event.target.tagName)
                    }
                }
            }
        })
    </script>
</body>

</html>